﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TestServer;
using BattleShips.Common;
using BattleShips.GameServers.BattleShipsGame;

namespace BattleShips.GameServers {
    class GameRoom {
        Dictionary<uint,GameClient> roomClients = new Dictionary<uint,GameClient>();
        public string RoomName { get; set; }
        public uint idRoom { get; set; }
        public uint RoomAdminId { get; set; }
        public string RStatus { get; set; }
        public bool GameIsEnd { get; set; }

        public void AddMasterClient(GameClient client) {
            roomClients.Add(client.IdPlayer,client);
            this.RoomAdminId = client.IdPlayer;
            roomClients[client.IdPlayer].Permission = "GameRoomAdmin"; 
        }
        public bool FreeSlot(){
            if (roomClients.Count < 2)
                return true;
            return false;
        }
        public void JoinNewPlayer(GameClient client) {
            roomClients.Add(client.IdPlayer,client);
            roomClients[client.IdPlayer].Permission = "GameRoomNUser";
            roomClients[client.IdPlayer].PlayerStatus = "Waiting";
            roomClients[client.IdPlayer].InRoomName = this.RoomName;
        }

        public Dictionary<uint, GameClient> GetRoomClients() {
            return roomClients;
        }
        
    }
}